<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单对象转普通对象</title>
</head>
<body>
    <form id="form" style="display: none;">
         <input type="email" value="test@email.com" name="email" />
         <input type="text" value="Test Name" name="name">
    </form>
</body>
<script>
    const formToObject = form => Array.from(new FormData(form)).reduce((acc,[k,v]) => ({ ...acc,[k]:v }),{});
    document.write(JSON.stringify(formToObject(document.querySelector('#form'))));
</script>
</html>